<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>

    <script>
        const m = new Map();
        const o = {name: 'chen'};
        m.set(o, 'chenchen');
        console.log(m.get(o));


        const map = new Map([
            ['name', 'chen'],
            ['age', 21]
        ]);
        console.log(map.size);
        console.log(map.get('name'));
        console.log(map.get('age'));

        for (let key of map.keys()) {
            console.log(key);
        }
        // name
        // age

        for (let value of map.values()) {
            console.log(value);
        }
        // chen
        // 21

        for (let [key, value] of map.entries()) {
            console.log(key, value);
        }
        // name chen
        // age 21

        // 等同于使用map.entries()
        for (let [key, value] of map) {
            console.log(key, value);
        }

    </script>

</head>
<body>

</body>
</html>